package com.qd.panda.gas.station.shell.resp.last;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.List;
import java.util.Optional;

/**
 * 加油站信息
 *
 * @author sjk
 * @create 2022-10-08 15:23
 * @since 1.0.0
 */
@Data
@Accessors(chain = true)
@ToString
public class GasStationDTO {
    /**
     * 站点ID
     */
    private Integer id;
    /**
     * 站点名称
     */
    private String name;
    /**
     * 站点品牌标识
     */
    @JsonProperty("company_name")
    private String companyName;
    /**
     * 站点地址
     */
    private String address;
    /**
     * 经度
     */
    private String longitude;
    /**
     * 纬度
     */
    private String latitude;
    /**
     * 站点logo
     */
    private String logo;
    /**
     * 省份code
     */
    @JsonProperty("province_code")
    private String provinceCode;
    /**
     * 省份中文
     */
    @JsonProperty("province_name")
    private String provinceName;
    /**
     * 城市code
     */
    @JsonProperty("city_code")
    private String cityCode;
    /**
     * 城市中文
     */
    @JsonProperty("city_name")
    private String cityName;
    /**
     * 品牌，自己计算，本来没有值
     */
    private String brand;

    @JsonProperty("gas_price")
    private List<GasPriceDTO> gun;


    public void freeData() {
        this.id = null;
        this.name = null;
        this.companyName = null;
        this.address = null;
        this.latitude = null;
        this.longitude = null;
        this.logo = null;
        this.provinceCode = null;
        this.provinceName = null;
        this.cityCode = null;
        this.cityName = null;
        this.brand = null;
        Optional.ofNullable(gun).ifPresent(gasPriceDTO -> gasPriceDTO.forEach(GasPriceDTO::freeData));
    }
}